#include "main.h"

static void delay_ms(u32 ms)
{
	u32 i = 84000000/4/1000*ms;
	while(i)
	{
		i--;
	}
}

int main(void)
{
	u8 keynum;
	u8 door_flag = 0;
	led_init();
	key_init();
	door_init();
	
	while(1)
	{
		keynum = key2_scan();
		if(keynum == 2)
		{
			door_flag = !door_flag;
			if(door_flag == 1)
			{
				open_door();
			}
			else if(door_flag == 0)
			{
				close_door();
			}
		}

	}
}

